Rapid Toolkit for Sparkplug component services are functionality sets that are complementary to the main task of the components. They provide features that are not directly derived from the underlying communication methods of the components, but rather have to do with their integration to the environment, instrumentation (such as configuration), licensing etc.
You can obtain services from a service provider object, which is any type that derives, directly or indirectly, from the IServiceProvider interface. The major Rapid Toolkit for Sparkplug components, such as the EasySparkplugConsumer Class and the EasySparkplugEdgeNode Class, and some other components, are all service providers as well.
The component services are identified by service type, which a .NET Type object, usually an interface. In order to obtain a service from a service provider, call its GetService method, passing it the type of service of you want to obtain. In most cases, the returned object is of the type you have specified (unless documented otherwise). You would therefore normally cast the received Object to the expected service type. In order to make the coding easier (in .NET), you can use the GetService<T> extension method, which saves you from using the typeof operator (in C#, or its equivalent in other languages) and from casting the result.
The GetService (or GetServiceByName) method returns a null reference when the specified interface type is not available. The set of services may depend on the various factors, such as the client object used, its configuration, software version etc. Unless you are sure that the service is available, your code should be able to handle the null result well, e.g. by gracefully degrading its functionality.
Different objects provide different types of services. The following paragraphs provide an overview of the types of services available from each major Rapid Toolkit for Sparkplug component.
Instances of the EasySparkplugConsumer Class can provide following services:
| Service Type (.NET) | Title/Purpose | Description |
| IDisposable | Disposable Object | Provides a mechanism for releasing unmanaged resources. Useful when you deal with a consumer interface already downcast to IServiceProvider. |
| IEasySparkplugConsumer | Sparkplug Consumer | The consumer itself. Useful when you deal with a consumer interface already downcast to IServiceProvider. |
| ILicenseInfoProvider | License Info Provider | Provides information about the licensed object. |
Instances of the EasySparkplugEdgeNode Class can provide following services:
| Service Type (.NET) | Title/Purpose | Description |
| IDisposable | Disposable Object | Provides a mechanism for releasing unmanaged resources. Useful when you deal with an edge node interface already downcast to IServiceProvider. |
| IEasySparkplugEdgeNode | Sparkplug Edge Node | The edge node itself. Useful when you deal with an edge node interface already downcast to IServiceProvider. |
| ISparkplugProducerMonitoring | Sparkplug Producer Monitoring | Provides methods and events to monitor the Sparkplug edge node or device. More information: Rapid Toolkit for Sparkplug Operation Monitoring Services. |
| ILicenseInfoProvider | License Info Provider | Provides information about the licensed object. Example: Examples - Sparkplug Licensing - Obtain serial number. |
Note that the ISparkplugProducerMonitoring component service is available both on the EasySparkplugEdgeNode Class and on the SparkplugDevice Class. Depending on where you obtain the service interface from, it provides operation monitoring for that edge node or a particular device.
Instances of the SparkplugDevice Class can provide following services:
| Service Type (.NET) | Title/Purpose | Description |
| IDisposable | Disposable Object | Provides a mechanism for releasing unmanaged resources. Useful when you deal with an edge node interface already downcast to IServiceProvider. |
| ISparkplugProducerMonitoring | Sparkplug Producer Monitoring | Provides methods and events to monitor the Sparkplug edge node or device. More information: Rapid Toolkit for Sparkplug Operation Monitoring Services. |
Note that the ISparkplugProducerMonitoring component service is available both on the EasySparkplugEdgeNode Class and on the SparkplugDevice Class. Depending on where you obtain the service interface from, it provides operation monitoring for that edge node or a particular device.
Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.